package com.gis507.test.csvdouble;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * 1
 */
public class CsvMapper extends Mapper<LongWritable, Text, IntWritable,Text> {

    private IntWritable outK = new IntWritable(1);

    private Text outV = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {

        //1
        String line = value.toString();

        //2
        String[] comments = line.split(",");

        outV.set(comments[0]);

        //3
        context.write(outK,outV);
    }
}
